import type { PageParams, PageResult } from '@/types/global'
import type { BannerItem, CategoryItem, GuessItem, HotItem } from '@/types/home'
import { http } from '@/utils/http'

/**
 * 首页-广告区域-小程序
 * @param distributionSite 广告区域展示位置（投放位置 投放位置，1为首页，2为分类商品页） 默认是1
 */
// export const getHomeBannerAPI = (distributionSite = 1) => {
//   return http<BannerItem[]>({
//     method: 'GET',
//     url: '/home/banner',
//     data: {
//       distributionSite,
//     },
//   })
// }

// 封装请求函数，轮播图区域
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite,
    },
  })
}
//封装商品分类的前台接口接口api
/**
 * 接口地址：/home/category/mutli

请求方式：GET
 */

export const getHomeCategoryAPI = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}
// 接口地址：/home/hot/mutli

// 请求方式：GET

export const getHomeHotAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}
// 接口地址：/home/goods/guessLike

// 请求方式：GET
/**猜你喜欢的api请求封装 */
export const getHomeGoodsGuessLikeAPI = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}
